package com.fxcalibre.hibernate.dao;

import java.util.List;

import com.fxcalibre.db.beans.MediaItem;
import com.fxcalibre.hibernate.GenericCriteria;
import com.fxcalibre.hibernate.HibernateUtils;

public class MediaItemsDAO
{

	@SuppressWarnings("unchecked")
	public static List<MediaItem> getMediaItems()
	{
		return (List<MediaItem>) HibernateUtils.buscar(crearCriterio());
	}

	public static GenericCriteria crearCriterio()
	{
		return new GenericCriteria(MediaItem.class.getName());
	}
	
	@SuppressWarnings("unchecked")
	public static List<MediaItem> getSeries()
	{
		String query = "SELECT distinct mi FROM  MediaItem mi where type = 'Serie'";
		return (List<MediaItem>) HibernateUtils.executeQuery(query);
	}

}
